package com.dingwei.superiordiary.mvp.presenter;

import com.dingwei.superiordiary.base.MyBaseBean;
import com.dingwei.superiordiary.bean.AboutUsBean;
import com.dingwei.superiordiary.bean.FailsBean;
import com.dingwei.superiordiary.custom.myCallback;
import com.dingwei.superiordiary.mvp.view.Contract;
import com.lihao.baselibrary.base.BaseActivity;
import com.lihao.baselibrary.base.URLS;
import com.lihao.baselibrary.base.basePresenter;

import org.xutils.http.RequestParams;
import org.xutils.x;

/**
 * Created by lihao on 2017/9/12.
 */

public class AboutUsPresenter extends basePresenter {

    private Contract.AboutUsView aboutUsView;

    public AboutUsPresenter(Contract.AboutUsView view) {
        super(view);
        this.aboutUsView = view;
    }

    public void getAboutUs() {

        RequestParams rp  =new RequestParams(URLS.HOST+URLS.ABOUT_US);
        x.http().post(rp, new myCallback(BaseActivity.context, AboutUsBean.class) {
            @Override
            public void back(MyBaseBean baseBean, String result) {
                AboutUsBean bean = (AboutUsBean) baseBean;
                aboutUsView.setData(bean);
            }

            @Override
            public void fail(FailsBean baseBean, String result) {
                aboutUsView.onFail();
            }
        });
    }
}
